<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                template="./../../template/templateSGPF.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core">

    <ui:define name="corpo da página">
        <center><h1>LISTA DE CONTRATOS  </h1></center>
        <h:form id="frmLista">            
            <p:dataTable id="tbUnidade" 
                         var="contrato" 
                         value="#{contratoServidorBean.lista}"
                         paginator="true" 
                         rows="10" 
                         emptyMessage="N&atilde;o h&aacute; dados para exibi&ccedil;&atilde;o"  
                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} 
                         {PageLinks} {NextPageLink} {LastPageLink}"
                         resizableColumns="">

                <p:column headerText="Servidor:"
                          filterBy="#{contrato.servidor.nome}" style="width: 20%;"
                          filterStyle="width:80%">
                    <h:outputText value="#{contrato.servidor.nome}"/>
                </p:column>

                <p:column headerText="Data inicial:"
                          filterBy="#{contrato.formataDataInicio}"
                          filterStyle="width:80%">
                    <h:outputText value="#{contrato.formataDataInicio}"/>
                </p:column>

                <p:column headerText="Data final:"
                          filterBy="#{contrato.formataDataFim}"
                          filterStyle="width:80%">
                    <h:outputText value="#{contrato.formataDataFim}"/>
                </p:column>

                <p:column headerText="Status:"
                          filterBy="#{contrato.status}"
                          filterStyle="width:80%">
                    <h:outputText value="#{contrato.status}"/>
                </p:column>

                <p:column style="width: 10%">
                    <p:commandLink 
                        title="Informações"                        
                        onclick="PF('informacao').show();"
                        update=":modInfoServidor"
                        >
                        <p:graphicImage value="/resources/img/infor.png"/>
                        <f:setPropertyActionListener
                            value="#{contrato}"
                            target="#{contratoServidorBean.cs}"/>
                    </p:commandLink>
                    <h:commandLink 
                        title="Alterar"
                        action="#{contratoServidorBean.alterar()}"
                        >
                        <p:graphicImage value="/resources/img/edit.png"/>
                        <f:actionListener binding="#{contratoServidorBean.putInSession(contrato)}" /> 
                    </h:commandLink>
<!--                    <h:commandLink action="{contratoServidorBean.printRelatorio()}"
                                   title="Imprimir"
                                   target="blank">
                        <p:graphicImage value="/resources/img/printer.png"/>
                    </h:commandLink>-->

                </p:column>
            </p:dataTable>
        </h:form>

        <p:dialog 
            header="Informações do Contrato"            
            id="modInfo"                               
            widgetVar="informacao" 
            closable="true"
            resizable="false"
            width="650"
            >
            <h:form id="modInfoServidor">
                <h:inputHidden id="servId" value="#{contratoServidorBean.cs}"/>
                <div class="row-fluid">                        
                    <div class="well-custom2">   
                        <div class="pull-left">
                            <div class="row-fluid">
                                <strong for="Nome" class="font-color-green">
                                    Servidor<strong style="color:red">*</strong>: </strong> 
                                <h:outputText value="#{contratoServidorBean.cs.servidor.nome} "/>
                            </div>
                            <div class="row-fluid"> 
                                <strong for="Sigla" class="font-color-green">
                                    Data inicial:</strong> 
                                <h:outputText value="#{contratoServidorBean.cs.formataDataInicio} "/>                                
                            </div>
                            <div class="row-fluid"> 
                                <strong for="CEP" class="font-color-green">
                                    Data final: </strong> 
                                <h:outputText value="#{contratoServidorBean.cs.formataDataFim} "/> 
                            </div>
                            <div class="row-fluid"> 
                                <strong for="Endereco" class="font-color-green">
                                    Matrícula/vínculo: </strong> 
                                <h:outputText value="#{contratoServidorBean.cs.matricula} "/> /
                                <h:outputText value="#{contratoServidorBean.cs.vinculo} "/> 
                            </div>
                        </div>                                                                                

                        <div class="pull-right">
                            <div class="row-fluid">                                    
                                <strong for="Estado" class="font-color-green">
                                    Status: <strong style="color:red">*</strong>: </strong> 
                                <h:outputText value="#{contratoServidorBean.cs.status} " />                                
                            </div>
                            <div class="row-fluid">                                    
                                <strong for="Municipio" class="font-color-green">
                                    Observação: <strong style="color:red">*</strong>: </strong> 
                                <div class="row-fluid"> 
                                    <div class="span6">
                                        <p:inputTextarea value="#{contratoServidorBean.cs.observacao}" 
                                                         readonly="true"
                                                         rows="3"
                                                         cols="30"
                                                         autoResize="false" 
                                                         styleClass="no-resize input"
                                                         style="width: 208px; color: blue;"
                                                         />                            
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>                        
                </div>
            </h:form>
        </p:dialog><!--


        -->
    </ui:define>

</ui:composition>
